package com.tensquare.user.dao;

import com.tensquare.user.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface UserDao extends JpaRepository<User,String> {
    //1.通过nickname查询用户
    User findByNickname(String nicename);
    //2.修改用户的粉丝数
    @Modifying
    @Query(nativeQuery=true,value="update tb_user set fanscount=fanscount+?2 where id=?1")
    void updateFans(String id, int count);
    //3.修改用户的follow值
    @Modifying
    @Query(nativeQuery=true,value="update tb_user set followcount=followcount+?2 where id=?1")
    void uodateFollow(String id, int count);
}
